#include<iostream>
using namespace std;

int n = 0;
int a,b,c;
int p1,p2,p3;
int sum = 0;

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		cin >> a >> b >> c; 
		p1 += a;
		p2 += b;
		p3 += c;
	}
	sum = p1 + p2 + p3;
	cout << p1 << " " << p2 << " " << p3 << " " << sum << endl;
	return 0;
}
